import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:industry_net/base/common/util.dart';

import 'index.dart';
import 'widgets/widgets.dart';

class ChatListPage extends StatelessWidget {
  ChatListPage({Key? key}) : super(key: key);
  final controller = Get.put(ChatListController());
  // 内容页
  Widget _buildView() {
    return ListView.separated(
        itemBuilder: (context, index) {
          return ChatListCell(md: controller.state.list![index]);
        },
        separatorBuilder: (context, index) {
          return separatorLine();
        },
        itemCount: controller.state.list?.length ?? 0);
  }

  @override
  Widget build(BuildContext context) {
    return GetBuilder<ChatListController>(
      builder: (_) {
        return Scaffold(
          body: SafeArea(
            child: _buildView(),
          ),
        );
      },
    );
  }
}
